<?php
/**
 * RMP助手公告列表
 * @author jianhui
 *
 */
class helperNoticeModel extends MY_Model{
    function helperNoticeModel(){
        parent::MY_Model();
        $this->table = 'HelperNotice';
    }
    /**
     * 显示端口
     * @return multitype:string
     */
    function getDisplayRole(){
        $displayRole = array(
            1=>'专营店端',
            2=>'小区督导端',
            3=>'大区总监端',
            4=>'区域端',
        );
        return $displayRole;
    }
    /**
     * 包装数据(non-PHPdoc)
     * @see MY_Model::packing()
     */
    function packing($list = array()){
        $displayRole = $this->getDisplayRole();
        foreach ($list as $k => $v){
            $list[$k]['displayRoleStr'] = isset($displayRole[$v['displayRole']]) ? $displayRole[$v['displayRole']] : '';
        }
        return $list;
    }
    /**
     * 获取指定角色最新公告内容
     * @param integer $diaplayRole
     */
    function getLatest($displayRole){
        $findList = $this->getList(array('displayRole'=>$displayRole), 1, null, '', 'id desc');
        if ($findList){
            $findList = array_values($findList);
            return isset($findList[0]) ? $findList[0] : false;
        }else{
            return false;
        }
    }
}